Extensible Code Contracts for Scala

نویسندگان

  • Rokas Matulis
  • Malte Schwerhoff
چکیده

Code contracts is a way to attribute the programs with formal the specifications, based on which the verification of those programs can be performed. The focus on software verification is increasing and the mainstream languages start to adopt this technique. Scala is an object oriented and functional programming language that is very expressive and has a strong type system. Hence, developing a code contracts solution for Scala is both interesting and challenging. In this thesis we build the basic contracts library for Scala which provides the means to express preand post-conditions for the methods. The main work is done in the compiler plugin which performs compile time rewriting of the program in order to support the inheritance of contracts and old expressions. Providing contracts the traditional way for a compiled library is not possible without the recompilation and redistribution. To solve this problem our rewriting tool enables the separation of contracts from the corresponding implementation. Such contracts can then be edited, distributed and used separately from the implementation. Code contracts for Scala is a starting point for further research so it has been designed with the extensibility in mind and could be supplemented with new types of contracts such as object invariants.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Call-graph-based Optimizations in Scala Semester Project

Scala [3] provides various high-level features that programmers can utilize in order to write readable, modular, and extensible code in a productive manner. Generics, virtual methods, higher-order functions and higher-kinded types [7] are some of these features. As one could expect, most of them come with a cost, generally in the form of an overhead in runtime performance. Take for example the ...

متن کامل

Generative Programming for Fast and Secure System Software

Figure 1: High-level user code in Scala (top) generates low-level C code (bottom), extended with automatically inferred annotations that enable static verification. How should we build systems that are performant, secure, and correct? Today, systems-level software such as network stacks, databases, and control code in embedded devices is almost always developed in C. This is suboptimal, for at ...

متن کامل

Developing Verified Software Using Leon

We present Leon, a system for developing functional Scala programs annotated with contracts. Contracts in Leon can themselves refer to recursively defined functions. Leon aims to find counterexamples when functions do not meet the specifications, and proofs when they do. Moreover, it can optimize run-time checks by eliminating statically checked parts of contracts and doing memoization. For ver...

متن کامل

Object-Oriented Pickler Combinators and an Extensible Generation Framework

Serialization or pickling, i.e., persisting runtime objects by converting them into a binary or text representation is ubiquitous in distributed programming. Pickler combinators are a popular approach from functional programming designed to alleviate some of the tedium of writing pickling code by hand, but they don’t translate well to object-oriented programming due to qualities like open class...

متن کامل

Self-Assembly: Lightweight Language Extension and Datatype Generic Programming, All-in-One!

In this paper we show a general mechanism, called self-assembly, for lightweight language extensions (LLEs). LLEs allow users to define generic operations or properties that operate over a large class of types. With LLEs it is possible, for example, for users to define their own Java-style automatic serialization mechanism; or implement simple forms of custom pluggable type system extensions li...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2012